import React, { Component } from 'react'
import bus from './bus'

export default class Child1 extends Component {
  constructor (props) {
    super()
    // console.log(props)
  }
  changeVla = () => {
    this.props.callback(false)
  }
  componentDidMount () {
    bus.on('myevent', val => {
      console.log('---border1---', val)
    })
  }
  render () {
    return (
      <div>
        <h3>classChild</h3>
        <p>
          {this.props.name} {this.props.age} 爱好：{this.props.hobby}
        </p>
        <p>{this.props.isMan ? '男士' : '女士'}</p>
        <p>
          住在{this.props.address.province},{this.props.address.city}
        </p>
        <button onClick={this.changeVla}>click</button>
      </div>
    )
  }
}
